<template>
  <div>
    <!-- <div class="wel__header">
      <div class="wel__info">
        <img :src="userInfo.avatar"
             alt=""
             class="wel__info-img">
        <div class="wel__info-content">
          <div class="wel__info-title">
            {{$t('wel.info')}}
          </div>
          <div class="wel__info-subtitle">
            {{$t('wel.dept')}}
          </div>
        </div>
      </div>
      <div class="wel__extra">
        <div class="wel__extra-item">
          <p class="wel__extra-title">
            {{ $t('wel.count')}}
          </p>
          <p class="wel__extra-subtitle">
            56
          </p>
        </div>
        <div class="wel__extra-item">
          <p class="wel__extra-title">
            {{ $t('wel.team')}}
          </p>
          <p class="wel__extra-subtitle">
            8 <span>/ 24</span>
          </p>
        </div>
        <div class="wel__extra-item">
          <p class="wel__extra-title">

            {{ $t('wel.project')}}
          </p>
          <p class="wel__extra-subtitle">
            2,223
          </p>
        </div>
      </div>
    </div> -->
    <basic-container>
      <h3>运营数据</h3>
      <avue-data-box :option="operationalData"></avue-data-box>
    </basic-container>
    <basic-container>
      <h3>财务数据</h3>
      <avue-data-box :option="financialData"></avue-data-box>
    </basic-container>
    <!--  <el-row :span="24">
      <el-col :span="18">
        <basic-container>
          <avue-data-progress :option="option3" style="margin-bottom:20px"></avue-data-progress>
          <avue-data-tabs :option="option"></avue-data-tabs>
        </basic-container>
      </el-col>
      <el-col :span="6">
        <basic-container>
          <avue-data-icons :option="option2"></avue-data-icons>
        </basic-container>
      </el-col>
    </el-row> -->
    <!-- <basic-container>
      <avue-crud :option="option4" :data="data">
      </avue-crud>
    </basic-container> -->
  </div>
</template>
<script>
import { mapGetters } from "vuex";
import { getAll } from '@/api/home/home.js'
export default {
  name: "wel",
  data() {
    return {
      operationalData: {
        span: 6,
        data: [{
            title: '总访问量',
            count: 1235,
            icon: "el-icon-view",
            color: "rgb(49, 180, 141)",

          },
          {
            title: '总咨询量',
            count: 33,
            icon: "el-icon-chat-line-square",
            color: "rgb(56, 161, 242)",

          },
          {
            title: '今日访客',
            count: 2223,
            icon: "el-icon-user",
            color: "rgb(117, 56, 199)",

          },
          {
            title: '今日咨询人数',
            count: 2223,
            icon: "el-icon-s-custom",
            color: "rgb(230, 71, 88)",

            target: "_blank"
          }
        ]
      },
      financialData: {
        span: 6,
        data: [{
            title: '总收入',
            count: 12332,
            icon: "el-icon-warning",
            color: "rgb(49, 180, 141)",

          },
          {
            title: '今日新增收入',
            count: 33,
            icon: "el-icon-view",
            color: "rgb(56, 161, 242)",

          },
          {
            title: '总付费用户',
            count: 2223,
            icon: "el-icon-setting",
            color: "rgb(117, 56, 199)",

          },
          {
            title: '今日付费用户',
            count: 2223,
            icon: "el-icon-setting",
            color: "rgb(230, 71, 88)",

          },
          {
            title: '总余额(元)',
            count: 2223,
            icon: "el-icon-setting",
            color: "rgb(230, 71, 88)",

          }
        ]
      }
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),


  },
  created() {
    this.dataInit()
  },
  methods: {
    dataInit() {
      getAll().then(res => {

        if (res.data.code == 200) {
          let result = res.data.data;
          this.operationalData.data[0].count = result.visits; //总访问量
          this.operationalData.data[1].count = result.consults; //总咨询量
          this.operationalData.data[2].count = result.visit; //今日访客
          this.operationalData.data[3].count = result.consult; //今日咨询

          // 财务数据
          this.financialData.data[0].count = result.incomes; //总收入
          this.financialData.data[1].count = result.income; //今日收入
          this.financialData.data[2].count = result.pays; //总付费用户
          this.financialData.data[3].count = result.pay; //今日付费用户
          this.financialData.data[4].count = result.balance; //余额

        }

      })
    }
  }
};

</script>
<style scoped="scoped" lang="scss">
h3 {
  margin-top: 0;
}

.wel {
  &__header {
    padding: 25px 40px;
    border-bottom: 1px solid #e8e8e8;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &__info {
    display: flex;
    align-items: center;

    &-img {
      border-radius: 72px;
      display: block;
      width: 72px;
      height: 72px;

      img {
        width: 100%;
        height: 100%;
        display: block;
      }
    }

    &-content {
      position: relative;
      margin-left: 24px;
      color: rgba(0, 0, 0, 0.45);
      line-height: 22px;
    }

    &-title {
      font-size: 20px;
      line-height: 28px;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.85);
      margin-bottom: 12px;
    }

    &-subtitle {
      position: relative;
      font-size: 14px;
      color: rgba(0, 0, 0, 0.45);
      line-height: 22px;
    }
  }

  &__extra {
    &-item {
      position: relative;
      padding: 0 32px;
      display: inline-block;

      &:last-child {
        &::after {
          display: none;
        }
      }

      &:after {
        background-color: #e8e8e8;
        position: absolute;
        top: 30px;
        right: 0;
        width: 1px;
        height: 40px;
        content: "";
      }
    }

    &-title {
      color: rgba(0, 0, 0, 0.45);
      font-size: 14px;
      line-height: 22px;
      margin-bottom: 4px;
    }

    &-subtitle {
      color: rgba(0, 0, 0, 0.85);
      font-size: 30px;
      line-height: 38px;
      margin: 0;

      span {
        color: rgba(0, 0, 0, 0.45);
        font-size: 20px;
      }
    }
  }
}

</style>
